var layer = layui.layer //弹层
    ,table = layui.table //表格
    ,form = layui.form,$ = layui.jquery,upload = layui.upload, model = getQueryVariable("model");

// 获取数据
function getQueryString(name) {
    var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
    var r = window.location.search.substr(1).match(reg);
    if (r != null) {
        return unescape(r[2]);
    }
    return null;
}
// console.log(getQueryString("_ijt"))

$("#userfile").on("change", function (e) {
    console.log(e.target.value)
    $("#userfilebtn").removeClass("layui-btn-normal").addClass("layui-btn-warm layui-icon layui-icon-chart")
    $("#userfilebtn").html("已选择文件")
})

function getxmselect(el, name, data) {
    return xmSelect.render({
        el: el,
        name: name,
        autoRow: true,
        tree: {
            show: true,
            showLine: true,
            showFolderIcon: true,
            indent: 20,
            expandedKeys: false
        },
        height: 'auto',
        data: data,
        on: function ({arr, change, isAdd}) {
            // console.log(arr, change, isAdd)
        }
    })
}

let val = [
    {name: '主键id', value: "id", selected: true, disabled: true},
    {name: '编码', value: "code"},
    {name: '联系人名称', value: "name"},
    {name: '简称', value: "abbreviation"},
    {name: '邮箱', value: "email"},
]
getxmselect("#filter", "filter", val);
form.render();
//监听提交
form.on('submit(formDemo)', function(data){
    console.log(model)
    console.log(data)
    console.log(getQueryString("_ijt"))

    return false;
});